/**
 * 
 */
package edu.pw.treegrid.server.filter;

import edu.pw.treegrid.server.query.QueryTree;

/** 
 * @author Piotrek
 */
public class OrFilter extends ComplexFilter {

	public void generateWhere(QueryTree queryTree, StringBuilder sb) {
		if (getFilters().isEmpty()) {
			return;
		}
		sb.append("\n(\n\t");
		boolean first = true;
		for (Filter f : getFilters()) {
			if (!first) {
				sb.append(" OR ");
			}
			first = false;
			f.generateWhere(queryTree, sb);
		}
		sb.append("\n)");
	}
	
	public String getXMLElementName() {
		return OperatorType.OR.toString();
	}	
}